using System;
using System.Collections.Generic;
using System.Text;
using Shc.Sql;
using Shc.Json;
namespace Slqj.Data
{
	public static class TableAdministrators
	{
		public const string Table = "Administrators";
		public const string AdministratorID = "AdministratorID";
		public const string LoginID = "LoginID";
		public const string Password = "Password";
		public const string Created = "Created";
		public const string LastLogin = "LastLogin";
		public const string IsActivate = "IsActivate";
		public const string UerType = "UerType";
	}
	
	[Serializable]
	public class BaseAdministrators
		: IDbSessionEntity, IJsonClass
	{
		int m_AdministratorID;
		/// <summary>
        /// 用户帐号表ID(主键)
        /// </summary>
        public int AdministratorID
        {
            get { return m_AdministratorID; }
            set { m_AdministratorID = value; }
        }
		
		string m_LoginID;
		/// <summary>
        /// 登录帐号
        /// </summary>
        public string LoginID
        {
            get { return m_LoginID; }
            set { m_LoginID = value; }
        }
		
		string m_Password;
		/// <summary>
        /// 登录密码
        /// </summary>
        public string Password
        {
            get { return m_Password; }
            set { m_Password = value; }
        }
		
		DateTime m_Created;
		/// <summary>
        /// 创建时间
        /// </summary>
        public DateTime Created
        {
            get { return m_Created; }
            set { m_Created = value; }
        }
		
		DateTime m_LastLogin;
		/// <summary>
        /// 最后登录时间
        /// </summary>
        public DateTime LastLogin
        {
            get { return m_LastLogin; }
            set { m_LastLogin = value; }
        }
		
		bool m_IsActivate;
		/// <summary>
        /// 是否可登录
        /// </summary>
        public bool IsActivate
        {
            get { return m_IsActivate; }
            set { m_IsActivate = value; }
        }
		
		int m_UerType;
		/// <summary>
        /// 
        /// </summary>
        public int UerType
        {
            get { return m_UerType; }
            set { m_UerType = value; }
        }
		
		
		#region IDbSessionEntity Members
		public void ReadDBData(RowDataReader reader)
        {
            m_AdministratorID = reader[TableAdministrators.AdministratorID];
            m_LoginID = reader[TableAdministrators.LoginID];
            m_Password = reader[TableAdministrators.Password];
            m_Created = reader[TableAdministrators.Created];
            m_LastLogin = reader[TableAdministrators.LastLogin];
            m_IsActivate = reader[TableAdministrators.IsActivate];
            m_UerType = reader[TableAdministrators.UerType];
        }
		
		public void WriteDBData(RowDataWriter writer)
        {
            writer.SetPrimaryKey(TableAdministrators.AdministratorID, PrimaryKeyType.Identity, AdministratorID);
			writer[TableAdministrators.LoginID] = LoginID;
			writer[TableAdministrators.Password] = Password;
			writer[TableAdministrators.Created] = Created;
			writer[TableAdministrators.LastLogin] = LastLogin;
			writer[TableAdministrators.IsActivate] = IsActivate;
			writer[TableAdministrators.UerType] = UerType;
        }

        public void SetIdentityAfterInsert(DBObject idd)
        {
            m_AdministratorID = idd;
        }
		
		public string TableName
        {
            get { return TableAdministrators.Table; }
        }
		#endregion
		
		#region IJsonClass Members

        public void JsonDeSerializeObj(JsonHashTable hashToRead)
        {
             m_AdministratorID = hashToRead["AdministratorID"];
			 
             m_LoginID = hashToRead["LoginID"];
			 
             m_Password = hashToRead["Password"];
			 
             m_Created = hashToRead["Created"];
			 
             m_LastLogin = hashToRead["LastLogin"];
			 
             m_IsActivate = hashToRead["IsActivate"];
			 
             m_UerType = hashToRead["UerType"];
			 
        }

        public void JsonSerializeObj(JsonHashTable hashToFill)
        {
            hashToFill["AdministratorID"] = AdministratorID;
			 
            hashToFill["LoginID"] = LoginID;
			 
            hashToFill["Password"] = Password;
			 
            hashToFill["Created"] = Created;
			 
            hashToFill["LastLogin"] = LastLogin;
			 
            hashToFill["IsActivate"] = IsActivate;
			 
            hashToFill["UerType"] = UerType;
			 
        }

        #endregion
		
	}
}
